﻿using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
using UnityEngine.UI;

namespace Gp.Scripts.GUI {
    public class BulletDisplayIcon : MonoBehaviour {
        [SerializeField] private Image icon;

        [SerializeField]
        private Color normalColor = Color.white;

        [SerializeField] private Color emptyColor = Color.gray;
        [SerializeField] private Color curColor = Color.yellow;

        [SerializeField] private float duration = .2f;

        private TweenerCore<Color, Color, ColorOptions> _tweenerCore;
        
        public void MarkAsEmpty() {
            _tweenerCore?.Kill();
            _tweenerCore = icon.DOColor(emptyColor, duration);
        }

        public void MarkAsCur() {
            _tweenerCore?.Kill();
            _tweenerCore = icon.DOColor(curColor, duration);
        }

        public void MarkAsRemain() {
            _tweenerCore?.Kill();
            _tweenerCore = icon.DOColor(normalColor, duration);
        }


        public void Clear() {
            _tweenerCore?.Kill();
            icon.color = emptyColor;
            gameObject.SetActive(false);
        }

        public void Show() {
            gameObject.SetActive(true);
        }
    }
}